package com.shangxian.giveithome.mapper;

import com.shangxian.giveithome.entity.petCard.PetCard;
import com.shangxian.giveithome.entity.petCard.inputParam.BackSearchParam;
import com.shangxian.giveithome.entity.petCard.inputParam.BackUpdatePetCardParam;
import com.shangxian.giveithome.entity.petCard.inputParam.BandingPetMessage;
import com.shangxian.giveithome.entity.petCard.outputParam.BackPetCardDetails;
import com.shangxian.giveithome.entity.petCard.outputParam.BackPetCardList;
import com.shangxian.giveithome.entity.petCard.outputParam.PetCardDetails;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author coderFu
 * @create 2021/5/2
 */
@Mapper
public interface PetCardMapper {

    /**
     * 根据二维码id检查二维码是否已经绑定宠物
     * @param id
     * @return
     */
    Object checkIsBindingPet(Long id);

    /**
     * 二维码绑定宠物信息
     * @param petCard
     * @return
     */
    int bandingPetMessage(PetCard petCard);

    /**
     * 根据宠物主人信息表id查询宠物信息（外键链表）
     * @param petCardId
     * @return
     */
    PetCardDetails findPetCardDetails(Long petCardId);

    /**
     * 根据用户id查询该用户绑定的所有宠物信息
     * @param userId
     * @return
     */
    List<PetCardDetails> findMyPetCardMessages(Long userId);

    /**
     * 更新宠牌信息
     * @param bandingPetMessage
     * @return
     */
    int updatePetCardMessage(BandingPetMessage bandingPetMessage);

    /**
     * 根据宠物二维码id查询宠牌id
     * @param petCardCodeId
     * @return
     */
    Long findPetCardIdByQrCodeId(Long petCardCodeId);

    /**
     * 根据宠牌id查询宠物用户信息
     * @param id
     * @return
     */
    BandingPetMessage findPetMessageById(Long id);


    /**
     * 后台接口使用
     * */

    /**
     * 查询所有的宠牌数目
     * @param backSearchParam
     * @return
     */
    int findAllPetCardCount(BackSearchParam backSearchParam);

    /**
     * 查询宠物主人信息列表
     * @param pageNumber
     * @param pageSize
     * @param backSearchParam
     * @return
     */
    List<BackPetCardList> findPetCardList(int pageNumber, int pageSize,BackSearchParam backSearchParam);

    /**
     * 根据宠牌记录id查询详细宠物信息
     * @param id
     * @return
     */
    BackPetCardDetails findPetCardDetailsById(Long id);

    /**
     * 后台根据宠牌表id修改宠牌绑定信息
     * @param backUpdatePetCardParam
     * @return
     */
    int backUpdatePetCardMessage(BackUpdatePetCardParam backUpdatePetCardParam);

    /**
     * 后台根据宠牌表id和用户身份证信息录入宠牌中制作宠物证书
     * @param id
     * @param identityId
     * @return
     */
    int backMakePetCert(Long id, String identityId);
}
